package app;

import java.io.File;

import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
import org.apache.naming.resources.VirtualDirContext;

public class Launcher {

	private static final String COMPILED_CLASSES_PATH = "/home/vova/Spring-workspace/Billing_Spring/";
//	private static final String COMPILED_CLASSES_PATH = "build/classes/main";
	
	public static void main(String[] args) throws Exception {
		Tomcat tomcat = new Tomcat();
		tomcat.setPort(8080);

		StandardContext ctx = (StandardContext) tomcat.addWebapp("/", new File("src/main/webapp").getAbsolutePath());
		VirtualDirContext resources = new VirtualDirContext();
		resources.setExtraResourcePaths("/WEB-INF/classes=" + new File(COMPILED_CLASSES_PATH).getAbsolutePath());
        ctx.setResources(resources);
        System.out.println("Server run!");
        
		tomcat.start();
		tomcat.getServer().await();
	}
}
